Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restructure parse_dandi_url() return type #605

Merged
merged 6 commits into from
Apr 30, 2021
Merged

Restructure parse_dandi_url() return type #605

merged 6 commits into from
Apr 30, 2021

Conversation

jwodder
Copy link
Member

@jwodder jwodder commented Apr 29, 2021

Closes #554.

Closes #598.

@jwodder jwodder added the minor Increment the minor version when merged label Apr 29, 2021
@codecov
Copy link

codecov bot commented Apr 29, 2021

Codecov Report

Merging #605 (64dee0c) into master (914a9cf) will increase coverage by 1.08%.
The diff coverage is 89.10%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #605      +/-   ##
==========================================
+ Coverage   83.08%   84.16%   +1.08%     
==========================================
  Files          59       59              
  Lines        5681     5778      +97     
==========================================
+ Hits         4720     4863     +143     
+ Misses        961      915      -46     
Flag Coverage Δ
unittests 84.16% <89.10%> (+1.08%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
dandi/tests/test_delete.py 100.00% <ø> (ø)
dandi/dandiarchive.py 84.57% <82.60%> (+4.29%) ⬆️
dandi/download.py 82.81% <90.90%> (-2.99%) ⬇️
dandi/cli/cmd_download.py 96.07% <100.00%> (+29.41%) ⬆️
dandi/cli/cmd_ls.py 66.46% <100.00%> (+9.15%) ⬆️
dandi/cli/tests/test_ls.py 100.00% <100.00%> (ø)
dandi/delete.py 86.06% <100.00%> (-3.55%) ⬇️
dandi/tests/test_dandiarchive.py 100.00% <100.00%> (ø)
... and 8 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 914a9cf...64dee0c. Read the comment docs.

Copy link
Member

@yarikoptic yarikoptic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor comments. I like how changes look in tests -- much more self-descriptive code ;)

dandi/cli/cmd_download.py Show resolved Hide resolved
@@ -110,11 +110,11 @@ def ls(paths, schema, metadata, fields=None, format="auto", recursive=False, job
def assets_gen():
for path in paths:
if is_url(path):
from ..dandiarchive import navigate_url
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you please add a test which would cover this code path? I have added raising an exception here and none of the tests flipped anyhow (directly via python or may be through external invocation of dandi ls)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the test just be a smoke test that calls ls with a URL (pointing to dandiarchive.org or the Docker instance?), or should it also expect something from the output?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess with -f json_pp you could expect nicely formatted record you could loads and if ran on a dandiset with assets -- could check that there is at least one asset (without getting into details)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

by -f json_pp I didn't mean "run in command line"... format="json_pp" ;)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests added.

dandi/dandiarchive.py Outdated Show resolved Hide resolved
from urllib.parse import unquote as urlunquote

from pydantic import AnyHttpUrl, BaseModel, parse_obj_as, validator
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just a note: likely because of this module RF and extra imports (but didn't investigate), code of this PR adds ~40 msec to dandi --help (to the total of 800ms, so about 5%)... at some point we might review import paths etc if we keep growing - since waiting seconds for --help might be a bit too much, and would be impediment if we add some shell completions support (IIRC I did not find any ready to use for click such as argcomplete which was odd)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI, click has command completion built-in: https://click.palletsprojects.com/en/7.x/bashcomplete/ (though I think some details may be changing in Click 8).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cool, filed #608 . Feel welcome to self-assign but it is of no urgency so I didn't

dandi/dandiarchive.py Show resolved Hide resolved
dandi/dandiarchive.py Show resolved Hide resolved
@yarikoptic
Copy link
Member

Thank you @jwodder -- let's proceed

@yarikoptic yarikoptic merged commit cf63ff9 into master Apr 30, 2021
@yarikoptic yarikoptic deleted the gh-554 branch April 30, 2021 21:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
minor Increment the minor version when merged
Projects
None yet
2 participants